package com.liyiqing.secondhandmall.productservice.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;

import com.liyiqing.commonservice.validator.ListValue;
import com.liyiqing.commonservice.validator.methodgroup.AddGroup;
import com.liyiqing.commonservice.validator.methodgroup.DeleteGroup;
import com.liyiqing.commonservice.validator.methodgroup.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * spu商品信息
 * 
 * @author LiYiQing
 * @email 1570865668@qq.com
 * @date 2022-02-18 23:36:20
 */
@Data
@TableName("product_spu_info")
public class ProductSpuInfoEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 商品id
	 */
	@TableId
	@Null(message = "新增时不可指定商品id",groups = {AddGroup.class})
	@NotNull(message = "修改或删除时必须指定商品id",groups = {UpdateGroup.class, DeleteGroup.class})
	private Long id;
	/**
	 * 卖家账号id(谁卖的)
	 */
	@NotNull(message = "新增时必须指定卖家账号id",groups = {AddGroup.class})
	private Long memberId;
	/**
	 * 商品名称
	 */
	@NotBlank(message = "商品名称不能为空",groups = {AddGroup.class})
	private String name;
	/**
	 * 商品描述
	 */
	@NotBlank(message = "商品描述不能为空",groups = {AddGroup.class})
	private String description;
	/**
	 * 所属二级分类id
	 */
	@NotNull(message = "新增时必须指定商品二级分类id",groups = {AddGroup.class})
	private Long groupId;
	/**
	 * 单价
	 */
	@NotNull(message = "商品单价不能为空",groups = {AddGroup.class})
	private BigDecimal price;
	/**
	 * 销售量
	 */
	private Long saleCount;
	/**
	 * 库存量
	 */
	@NotNull(message = "库存量不能为空",groups = {AddGroup.class})
	private Long stockCount;
	/**
	 * 上架状态[0：下架，1：上架]
	 */
	@TableLogic(value="1",delval="0")
	@ListValue(values = {0,1},message = "账号状态只能是:【1(上架)】or【0(下架)】")
	private Integer publishStatus;
	/**
	 * 创建时间
	 */
	private String createTime;
	/**
	 * 更新时间
	 */
	private String updateTime;

}
